package com.wuhenzhizao.sku.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.io.Serializable;
import java.util.List;

/**
 * Created by wuhenzhizao on 2017/3/6.
 */
public class Sku implements Serializable {
    private String id;
    private String mainImage; //规格图片
    private int stockQuantity;
    private int goodsBuyLimit;
    private boolean inStock;
    private String originPrice;
    private String sellingPrice;
    private String pointsPrice;
    private String pointsSalePrice;
    private List<SkuAttribute> attributes;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getMainImage() {
        return mainImage;
    }

    public void setMainImage(String mainImage) {
        this.mainImage = mainImage;
    }

    public String getPointsPrice() {
        return pointsPrice == null ? "" : pointsPrice;
    }

    public void setPointsPrice(String pointsPrice) {
        this.pointsPrice = pointsPrice;
    }

    public String getPointsSalePrice() {
        return pointsSalePrice == null ? "" : pointsSalePrice;
    }

    public void setPointsSalePrice(String pointsSalePrice) {
        this.pointsSalePrice = pointsSalePrice;
    }

    public int getStockQuantity() {
        return stockQuantity;
    }

    public void setStockQuantity(int stockQuantity) {
        this.stockQuantity = stockQuantity;
    }

    public boolean isInStock() {
        return inStock;
    }

    public void setInStock(boolean inStock) {
        this.inStock = inStock;
    }

    public String getOriginPrice() {
        return originPrice == null ? "" : originPrice;
    }

    public void setOriginPrice(String originPrice) {
        this.originPrice = originPrice;
    }

    public String getSellingPrice() {
        return sellingPrice == null ? "" : sellingPrice;
    }

    public void setSellingPrice(String sellingPrice) {
        this.sellingPrice = sellingPrice;
    }

    public int getGoodsBuyLimit() {
        return goodsBuyLimit;
    }

    public void setGoodsBuyLimit(int goodsBuyLimit) {
        this.goodsBuyLimit = goodsBuyLimit;
    }

    public List<SkuAttribute> getAttributes() {
        return attributes;
    }

    public void setAttributes(List<SkuAttribute> attributes) {
        this.attributes = attributes;
    }

    public String getSelectSkuInfo() {
        String skuInfo = "";
        if (attributes == null) return skuInfo;

        for (int i = 0; i < attributes.size(); i++) {
            skuInfo += attributes.get(i).getKey() + attributes.get(i).getValue() + ",";
        }
        return skuInfo.substring(0, skuInfo.length() - 1);
    }

    @Override
    public String toString() {
        return "Sku{" +
                "id='" + id + '\'' +
                ", mainImage='" + mainImage + '\'' +
                ", stockQuantity=" + stockQuantity +
                ", inStock=" + inStock +
                ", originPrice=" + originPrice +
                ", sellingPrice=" + sellingPrice +
                ", attributes=" + attributes +
                '}';
    }

    public Sku() {
    }

}
